{% extends "base_generic.html" %}
{% block script %}
<script type="text/javascript">
  function generateUrl(name) {
    var sanitizedName = name;
    sanitizedName = sanitizedName.replace(/ el /gi, ' ');
    sanitizedName = sanitizedName.replace(/ la /gi, ' ');
    sanitizedName = sanitizedName.replace(/ los /gi, ' ');
    sanitizedName = sanitizedName.replace(/ las /gi, ' ');
    sanitizedName = sanitizedName.replace(/ de /gi, ' ');
    sanitizedName = sanitizedName.replace(/ del /gi, ' ');
    sanitizedName = sanitizedName.replace(/ temporada /gi, ' ');
    sanitizedName = string_to_slug(sanitizedName);
    sanitizedName = sanitizedName.replace(/--/gi, '-');
    sanitizedName = sanitizedName.replace(/---/gi, '-');
    sanitizedName = sanitizedName.replace(/----/gi, '-');
    $("#slug").val(sanitizedName);
  }
  $(window).load(
    function() {
      $(':input:visible:enabled:first').focus();
    });
</script>
{% endblock %}
{% block content %}
        <h1>Enlace</h1>
        <form action="/admin/enlaces/{{ key }}/save/" method="post">
        
        <div class="line">
          <div class="field">
            <label>Name:</label>
            <input id="name" name="name" type="text" size="65" value="{{ name }}" onblur="generateUrl(this.value);" />
          </div>
        </div>
        <div class="line">
          <div class="field">
            <label>URL:</label>
            <input id="url" name="url" type="text" size="50" value="{{ url }}" />
          </div>
        </div>
        <div class="line">
            <div class="field">
              <label>Description:</label>
              <textarea id="description" name="description">{{ description }}</textarea>
            </div>
          </div>
        <input type="hidden" name="codenum" id="codenum" value="{{ filekey }}" />
        <input type="submit" value="Guardar" id="save" name="save" name="save" /><br class="clear" />
      </form>
      <br class="clear" />

{% endblock %}
      